//统一管理相关的接口
import request from "@/utils/request";

//统一管理接口
enum API {
    //利率矩阵
    METRIX_URL = "/itp/api/metrix/data",
    //利率走势
    Trend_URL = "/itp/api/rate/trend",
    //信用利差
    Margin_URL = "/itp/api/rate/margin"
}


//暴露请求函数
//获取利率数据
export const getMetrix = (data: getMetrixFormType) => request.post(API.METRIX_URL, data);
export interface getMetrixFormType {
    currentDate: string;
    baseDate: string;
    prefCombinationName: string;
}
//获取利率走势
export const getTrend = (data: getTrendFormType) => request.post(API.Trend_URL, data);
export interface getTrendFormType {
    currentDate: string;
    baseDate: string;
    prefCombinationName: string;
    codeList: string[];
}

//获取信用利差
export function postRateMargin(currentDate?: string){
    return request.post(API.Margin_URL, {'currentDate':currentDate});
}
//获取利差走势
export const getRateMarginTrend = (data: getTrendFormType) => request.post(`${API.Margin_URL}/trend`, data);
export interface getTrendFormType {
    currentDate: string;
    baseDate: string;
    prefCombinationName: string;
    codeList: string[];
}
export const getRateMarginAllType = () => request.get(`${API.Margin_URL}/allType`);

//资金面跟踪
export const postCashTrack = (data: getTrendFormType) => request.post("/itp/api/cash/track", data);
export const getRateTrendAllType = () => request.get(`${API.Margin_URL}/trend/allType`);

export const postWeekDay = (data:any) => request.post("/itp/api/system/holiday/next/day", data);